//
//  YJYBrowserScrollView.m
//  BannerViewDemo
//
//  Created by BaizYi on 2018/11/2.
//  Copyright © 2018 BaizYi. All rights reserved.
//

#import "YJYBrowserScrollView.h"

@implementation YJYBrowserScrollView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.minimumZoomScale = 1.0f;
        self.maximumZoomScale = 3.0f;
        self.delegate = self;
        _zoomImageView = [[UIImageView alloc]init];
        _zoomImageView.userInteractionEnabled = YES;
        _zoomImageView.contentMode = UIViewContentModeScaleAspectFit;
//        _zoomImageView.clipsToBounds = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onTap:)];
        [_zoomImageView addGestureRecognizer:tap];
        [self addSubview:_zoomImageView];
    }
    return self;
}

-(void)onTap:(UIGestureRecognizer *)tap{
    if (self.tapBlock) {
        self.tapBlock();
    }
}

-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
    return _zoomImageView;
}


@end
